#include<iostream>
using namespace std;
struct Person{
    char name[20];
    int Chinese;
    int data;
    int English;
}stu[10] = {{"stu1",70,80,90},{"stu2",75,85,87},{"stu3",69,89,72},{"stu4",78,85,90},
            {"stu5",99,72,78},{"stu6",75,78,88},{"stu7",88,95,90},{"stu8",76,85,89},
            {"stu9",89,92,90},{"stu10",88,79,85}};

float ave(){
    float score1=0;
    float score2=0;
    float score3=0;
    int i;
    for(i=0;i<10;i++){
        score1=score1+stu[i].Chinese;
        score2=score2+stu[i].data;
        score3=score3+stu[i].English;
    }
    score1=score1/10;
    score2=score2/10;
    score3=score3/10;
    cout<<"语文平均分为："<<score1<<endl;
    cout<<"数据平均分为："<<score2<<endl;
    cout<<"英语平均分为："<<score3<<endl;
}

/*int total(){
    int grade[10],i;
    for(i=0;i<3;i++){
        grade[i]=stu[i].Chinese+stu[i].data+stu[i].English;
        cout<<"学生"<<stu[i].name<<"的总成绩为："<<grade[i]<<endl;
    }
    
}*/

void maxmin(){
    int grade[10],i;
    for(i=0;i<3;i++){
        grade[i]=stu[i].Chinese+stu[i].data+stu[i].English;
        cout<<"学生"<<stu[i].name<<"的总成绩为："<<grade[i]<<endl;
    }
    int max=0,min=0;
    for(i=1;i<10;i++){
        if(grade[max]<grade[i])
            max=i;
        if(grade[min]>grade[i])
           min=i;
    }
    cout<<"成绩最高的学生为"<<stu[max].name<<endl;
    cout<<"成绩最低的学生为"<<stu[min].name<<endl;
}
int main(){
    ave();
    maxmin();
    return 0;
}